package org.csmzxy.class2333;

public class Example02 {
    public static void main(String[] args) {
        int[] arr = {1,13,2,3,8};
        for (int i = 0; i<arr.length-1; i++){
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] > arr[j + 1]) {
                    int tmp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = tmp;
                }
            }
        }
        System.out.print("排序后的数组：");
        for (int num : arr) {
            System.out.print(num + " ");
        }
        System.out.println();
        int max = arr[arr.length - 1];
        System.out.println("最大值：" + max);
    }
}